package com.ruoyi.network.config;

import java.util.Iterator;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class NetworkStartup implements ApplicationRunner{
	@Autowired
	private ApplicationContext applicationContext;
	@Override
	public void run(ApplicationArguments args) throws Exception {
		Map<String, NetworkComponent> components = applicationContext.getBeansOfType(NetworkComponent.class);
		Iterator<String> it = components.keySet().iterator();
		while(it.hasNext()) {
			String k = it.next();
			NetworkComponent c = components.get(k);
			c.start();
		}
	}

}
